from datetime import datetime

from pytz import timezone


def get_date_time(time_format="%Y-%m-%d %H:%M:%S", get_datetime: bool = False):
    date_and_time = (
        datetime.now(timezone("Europe/Moscow"))
        .replace(tzinfo=None)
        .replace(microsecond=0)
    )

    if not get_datetime:
        date_and_time = date_and_time.strftime(time_format)

    return date_and_time


def format_datetime(date: datetime, time_format="%Y-%m-%d %H:%M:%S") -> str:
    return date.strftime(time_format)
